package main

import (
	"fmt"
	"go-base-learning/src/14_object_oriented/package/model"
)

// JudgeType 判断输入的参数是什么类型
func JudgeType(args ...interface{}) {
	for index, arg := range args {
		switch arg.(type) {
		case bool:
			fmt.Printf("第%d个参数是bool类型，值是%v\n", index, arg)
		case float32:
			fmt.Printf("第%d个参数是float32类型，值是%v\n", index, arg)
		case float64:
			fmt.Printf("第%d个参数是float64类型，值是%v\n", index, arg)
		case int, int8, int16, int32, int64:
			fmt.Printf("第%d个参数是整数类型，值是%v\n", index, arg)
		case string:
			fmt.Printf("第%d个参数是bool类型，值是%v\n", index, arg)
		case model.Student:
			fmt.Printf("第%d个参数是model.Student类型，值是%v\n", index, arg)
		case *model.Student:
			fmt.Printf("第%d个参数是*model.Student类型，值是%v\n", index, arg)
		default:
			fmt.Printf("第%d个参数无法确定类型类型，值是%v\n", index, arg)
		}
	}
}

func main() {
	var arg1 int = 1
	var arg2 float32 = 2.2
	var arg3 float64 = 3.3
	var arg4 bool = true
	var arg5 string = "abc"
	var arg6 interface{}
	JudgeType(arg1, arg2, arg3, arg4, arg5, arg6, model.Student{Name: "Tom", Score: 10}, &model.Student{Name: "Jack", Score: 100})
}
